/**
* Helper class used to offer various functionnalities such as
* double<->String conversion etc....
*
* Freely inspired from http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207226548
*/ 
String Utils::doubleToString(double in,byte precision)
{
 // TODO: test
 String res;
 res=int(in);
 if(precision>0)
 {
  res+=".";
  unsigned long frac;
  unsigned long mult=1;
  byte padding=precision-1;
  while(precision--)
  {
   mult*=10;
  }
  if(in>=0)
  {
   frac=(in-int(in))*mult;
  }
  else
  {
   frac=(int(in)-in)*mult;
  }
  unsigned long fac1=frac;
  while(frac1/=10)
  {
   padding--;
  }
  while(padding--)
  {
   res+="0";
  }
  res+=frac;
 }
 return res;
}
